#pragma once

namespace DivelReader
{
public ref class DateConverter sealed : public Windows::UI::Xaml::Data::IValueConverter  
{
public:
    virtual Platform::Object^ Convert(Platform::Object^ value,
        Windows::UI::Xaml::Interop::TypeName targetType,
        Platform::Object^ parameter,
        Platform::String^ language)
        {
            auto dt = (Windows::Foundation::DateTime) value; 
            auto dtf =
                Windows::Globalization::DateTimeFormatting::DateTimeFormatter::LongDate::get();
            return dtf->Format(dt); 
        }

    virtual Platform::Object^ ConvertBack(Platform::Object^ value,
        Windows::UI::Xaml::Interop::TypeName targetType,
        Platform::Object^ parameter,
        Platform::String^ language)
        {   
            //Not used. Left as exercise for the reader!
            throw ref new Platform::NotImplementedException();
        }
    };
}
